<!--部门分红表-->
<template>
  <div>
    <f-table ref='table' rowKey='paymentId' :showSetting='true' :dataSource='dataSource' setting-key='bonus_info' :tableColumns='columns' :scroll='{x:true}' handler='noSettlePageListHandler' :showMultipleBtn='false' :operator='operator' :multiple='multiple' :params='queryParam' :autoLoad='false'>
       <span slot='ownerState' slot-scope='text, record, index'>
            <a-tag color='#108ee9' v-if='text==0'>否</a-tag>
            <a-tag color='#f50' v-if='text==1'>是</a-tag>
       </span>
      <span slot='supplierBondType' slot-scope='text, record, index'>
            <a-tag color='#2db7f5' v-if='text==0'>不垫付</a-tag>
            <a-tag color='purple' v-if='text==1'>底价</a-tag>
            <a-tag color='purple' v-if='text==2'>底价+税金</a-tag>
            <a-tag color='purple' v-if='text==3'>税金</a-tag>
            <a-tag color='purple' v-if='text==6'>底价/2+税金</a-tag>
            <a-tag color='purple' v-if='text==5'>全额垫付</a-tag>
            <a-tag color='purple' v-if='text==8'>销售金额*费率</a-tag>
        </span>
      <span slot='customBondType' slot-scope='text, record, index'>
           <a-tag color='#2db7f5' v-if='text==0'>全款</a-tag>
            <a-tag color='purple' v-if='text==1'>底价</a-tag>
            <a-tag color='purple' v-if='text==2'>底价+税金</a-tag>
            <a-tag color='purple' v-if='text==6'>底价/2+税金</a-tag>
            <a-tag color='purple' v-if='text==3'>税金</a-tag>
            <a-tag color='purple' v-if='text==5'>全额资信</a-tag>
            <a-tag color='purple' v-if='text==7'>预付款</a-tag>
        </span>
      <span slot='action' slot-scope='text, record'>
          <template>
            <a href='javascript:;'  >提交审批</a>
            <a-divider type='vertical'  />
            <a @click='$refs.bonusInfoDrawer.showDrawer(record)'>明细</a>
          </template>
         <a-divider type='vertical'  />
         <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
            <a-menu slot="overlay">
              <a-menu-item >
                <a href="javascript:;" >打印资金支付单</a>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
    </f-table>
    <bonus-info-drawer ref="bonusInfoDrawer"></bonus-info-drawer>
    <bonus-add-modal ref='bonusAddModal'></bonus-add-modal>
  </div>
</template>
<script>
import api from "../../js/api"
import BonusInfoDrawer from './components/bonus_info_drawer'
import BonusAddModal from "./components/bonus_add_modal"

export default {
  name: "Tab2",
  components: { BonusAddModal, BonusInfoDrawer },
  data() {
    let me = this
    //操作按钮
    let operator = [
      
    ]
    operator.push({
      name: "新建分红",
      icon: "transaction",
      that: this,
      handler: function(table, that) {
        that.openAddModal();
      }
    })
    return {
      api: Object.assign(api, this.api),
      multiple: false,
      deptId: "",
      //列表初始化查询参数
      queryParam: {
        auth:1
      },
      returnCustomBond: 0,
      selectIds: "",
      params1: {
        deptId: ""
      },
      dataSource:[{
        paymentId:1,
        bonusMonth:'2023-06',
        deptName:'商务一部',
        saleManName:'王硕',
        amount:'857847',
        userName:'测试',
        paymentState:0,
        amountDate:'2023-05-06',
      }],
      columns: [
        {
          title: "序号",
          width: "40px",
          align: "center",
          customRender: (text, record, index) => index + 1
        },
        {
          title: "分红月份",
          align: "center",
          width: "110px",
          dataIndex: "bonusMonth"
        },
        {
          title: "部门名称",
          align: "center",
          width: "100px",
          dataIndex: "deptName"
        },
        {
          title: "负责人",
          align: "center",
          width: "100px",
          dataIndex: "saleManName"
        },
        {
          title: "申请金额",
          align: "center",
          width: "100px",
          dataIndex: "amount"
        },
        {
          title: "制单人",
          align: "center",
          ellipsis: true,
          width: "100px",
          dataIndex: "userName"
        },
        {
          title: "状态",
          align: "center",
          width: "80px",
          dataIndex: "paymentState"
        },
        {
          title: "申请日期",
          align: "center",
          ellipsis: true,
          width: "140px",
          dataIndex: "amountDate"
        },
        {
          title: "备注",
          align: "left",
          width: "200px",
          dataIndex: "remark"
        },{
          title: "操作",
          align: "left",
          dataIndex: "action",
          width: "150px",
          scopedSlots: { customRender: "action" }
        },
      ],
      operator: operator
    }
  },
  created() {
  },
  methods: {
    setData() {
    },
    //部门切换
    deptChange(value) {
      this.queryParam.deptId = value
      this.$refs.table.refresh(false)
    },
    /**
     * 查询事件
     * @param searchParams
     */
    searchTable(searchParams) {
      this.queryParam = Object.assign(this.queryParam, searchParams)
      this.$refs.table.refresh(true, searchParams)
    },
    openMultiple(searchParams) {
      if (searchParams.deptId) {
        this.multiple = true
        this.deptId = searchParams.deptId
      }
    },
    openAddModal(record) {
      this.$refs['bonusAddModal'].showModal(record)
    },
    /**
     * 刷新列表
     */
    onLoad() {
      this.$refs.table.refresh()
      this.$emit("changeTab")
    }
  }
}
</script>
supplierBondState